home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
FromTheMag
/
JW FLV MEDIA PLAYER 4.2
/
mediaplayer.exe
/
player.swf
/
scripts
/
com
/
jeroenwijering
/
parsers
/
ASXParser.as
next >
Wrap
Text File
|
2008-11-04
|
2KB
|
78 lines
package com.jeroenwijering.parsers
{
import com.jeroenwijering.utils.Strings;
public class ASXParser extends ObjectParser
{
public function ASXParser()
{
super();
}
public static function parse(param1:XML) : Array
{
var _loc2_:Array = null;
var _loc3_:Object = null;
var _loc4_:XML = null;
_loc2_ = new Array();
_loc3_ = new Object();
for each(_loc4_ in param1.children())
{
_loc3_ = ASXParser.parseItem(_loc4_);
if(_loc3_["type"] != undefined)
{
_loc2_.push(_loc3_);
}
_loc3_ = {};
}
return _loc2_;
}
public static function parseItem(param1:XML) : Object
{
var _loc2_:Object = null;
var _loc3_:XML = null;
_loc2_ = new Object();
for each(_loc3_ in param1.children())
{
if(!_loc3_.localName())
{
break;
}
switch(_loc3_.localName().toLowerCase())
{
case "ref":
_loc2_["file"] = _loc3_.@href.toString();
continue;
case "title":
_loc2_["title"] = _loc3_.text().toString();
continue;
case "moreinfo":
_loc2_["link"] = _loc3_.@href.toString();
continue;
case "abstract":
_loc2_["description"] = _loc3_.text().toString();
continue;
case "author":
_loc2_["author"] = _loc3_.text().toString();
continue;
case "duration":
_loc2_["duration"] = Strings.seconds(_loc3_.@value);
continue;
case "starttime":
_loc2_["start"] = Strings.seconds(_loc3_.@value);
continue;
case "param":
_loc2_[_loc3_.@name] = _loc3_.@value.toString();
continue;
default:
continue;
}
}
return ObjectParser.complete(_loc2_);
}
}
}